<?php

// +----------------------------------------------------------------------
// | Unit测试基类，其它测试类需要继承此类
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------

namespace tests;

class TestCase extends \think\testing\TestCase
{

    protected $baseUrl = 'http://www.mall.com';

    //模拟登录
    protected function mockLogin($url, $parameters = [])
    {
        $uid = 1;
        session('uid', $uid);
        $member = model("Common/Member")->getMemberInfo($uid);
        $cookie = [];
        $cookie[session_name()] = session_id();
        $cookie['uinfo'] = $member;
        $cookie['cart_goods_num'] = 0;
        return $this->makeRequest('GET', $url, $parameters, $cookie);
    }

}
